﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>
<%
IF (Request.QueryString("Action")="save") Then
	call save
else
	call add
End IF
end Function
%>
<%sub add
	dim url,i
	url=Request("url")
	if url="" then url="index.asp"
                Set Rs = Server.CreateObject("Adodb.Recordset")
		Sql = "select * from [qingtian_user] where sid= '"&qingtian.Formatsid(sid)&"'"
		Rs.Open Sql,conn,1,1
		if not (rs.bof and rs.eof)  then
select case v
case "0"
%>
<card id="add" title="修改资料"><p align="<%=qingtian.px%>">
<b>你好<%=session("username")%>(ID:<%=qingtian.nid%>)请完善你的资料!</b><br/>
-------------<br/>
		昵称:<br/>
		<input name="users" emptyok="true" size='15' type="text" value="<%=qingtian.utf8(rs("name"))%>" maxlength="10"/><br/>
		省份:<br/>
		<input name="shen" emptyok="true" size='15' type="text" value="<%=qingtian.utf8(left(rs("diqu"),instr(rs("diqu"),",")-1))%>" maxlength="4"/><br/>
		城市:<br/>
		<input name="shii" emptyok="true" size='15' type="text" value="<%=qingtian.utf8(Replace(rs("diqu"),left(rs("diqu"),instr(rs("diqu"),",")),""))%>" maxlength="4"/><br/>
		年龄:<br/>
		<input name="nian" emptyok="true" size='15' type="text" value="<%=rs("nianlin")%>" format="*N" maxlength="4"/><br/>
                性别<select name='sex' value='2'>
                <option value="1">男性</option>
                <option value="2">女性</option>
                </select><br/>
		Q Q:<br/>
		<input name="qq" emptyok="true"  size='15' value="<%=rs("qq")%>" format="*N" maxlength="15"/><br/>
		邮 箱:<br/>
		<input name="email" emptyok="true"  size='15' type="text" value="<%=rs("mail")%>" maxlength="50"/><br/>
		签名:<br/>
		<input name="mark" emptyok="true"  size='15' value="<%=rs("mark")%>" type="text"/><br/>
		<anchor>快速更新
			<go href="usermodify.asp?Action=save&amp;sid=<%=sidd%>" method="post">
				<postfield name="users" value="$(users:n)" />
				<postfield name="shen" value="$(shen:n)" />
				<postfield name="shii" value="$(shii:n)" />
                                <postfield name="nian" value="$(nian:n)" />
                                <postfield name="qq" value="$(qq:n)" />
                                <postfield name="sex" value="$(sex:n)" />
				<postfield name="email" value="$(email:n)" />
                                <postfield name="mark" value="$(mark:n)" />
			</go>
		</anchor><br/>(注意不可以留空哦!)
<br/>-------------<br/>
<a href="UserInfo.Asp?sid=<%=sidd%>">我的详细资料</a><br/>
<%
case "1"
hr=""
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>修改资料</title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%=dao%><b>你好<%=session("username")%>(ID:<%=qingtian.nid%>)请完善你的资料!</b><%=we0%><%=hr%><%=we%>
<form action="usermodify.asp?Action=save&amp;sid=<%=sidd%>" method="post">
		昵称:<br/>
		<input name="users" emptyok="true" size='15' type="text" value="<%=qingtian.utf8(rs("name"))%>" maxlength="10"/><br/>
		省份:<br/>
		<input name="shen" emptyok="true" size='15' type="text" value="<%=qingtian.utf8(left(rs("diqu"),instr(rs("diqu"),",")-1))%>" maxlength="4"/><br/>
		城市:<br/>
		<input name="shii" emptyok="true" size='15' type="text" value="<%=qingtian.utf8(Replace(rs("diqu"),left(rs("diqu"),instr(rs("diqu"),",")),""))%>" maxlength="4"/><br/>
		年龄:<br/>
		<input name="nian" emptyok="true" size='15' type="text" value="<%=rs("nianlin")%>" format="*N" maxlength="4"/><br/>
                性别<select name='sex' value='2'>
                <option value="1">男性</option>
                <option value="2">女性</option>
                </select><br/>
		Q Q:<br/>
		<input name="qq" emptyok="true"  size='15' value="<%=rs("qq")%>" format="*N" maxlength="15"/><br/>
		邮 箱:<br/>
		<input name="email" emptyok="true"  size='15' type="text" value="<%=rs("mail")%>" maxlength="50"/><br/>
		签名:<br/>
		<input name="mark" emptyok="true"  size='15' value="<%=rs("mark")%>" type="text"/><br/>
                <input type="submit" value="快速更新" /></form><br/>(注意不可以留空哦!)<%=we0%><%=hr%>
			<%=sou%><a href="UserInfo.Asp?sid=<%=sidd%>">我的详细资料</a><%=we0%>
<%
End Select
else
qingtian.err("该会员不存在")
end if
rs.close
set rs=nothing
end sub
%>
<%sub save
	dim rs,sql,rs8,sql8,i,id

	dim name,pass,users,sex,mail,errmsg,flag,pic,shen,shii,qq,mark

		shen=Replace(qingtian.repsql(Request.form("shen")),"'","''")
		shii=Replace(qingtian.repsql(Request.form("shii")),"'","''")
		users=Replace(qingtian.repsql(Request.form("users")),"'","''")
		mail=Replace(trim(Request.form("email")),"'","''")
		nian=Replace(trim(Request.form("nian")),"'","''")
		mark=Replace(qingtian.repsql(Request.form("mark")),"'","''")
		qq=Replace(trim(Request.form("qq")),"'","''")
		sex=Request.form("sex")
                if sex=1 then 
                sex="男"
                else 
                sex="女"
                end if
select case v
case "0"
we0="<br/>"
title1="<card id=""login"" title=""修改资料""  ontimer=""usermodify.asp?Action=add&amp;sid="&sidd&"""><timer value='20'/><p align="""&qingtian.px&""">"
title2="<card id=""save"" title=""修改资料""><p align="""&qingtian.px&""">"
case "1"
hr="<hr>"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
title1="<meta name=""keywords"" content="",V1.0""/><meta name=""author"" content=""晴天建站""/><meta http-equiv=""Cache-Control"" content=""max-age=0"" forua=""true""/><meta http-equiv=""Cache-Control"" content=""no-cache""/><meta http-equiv=""Expires"" content=""0""/><meta http-equiv=""Refresh"" content=""1; url=usermodify.asp?Action=add&amp;sid="&sidd&"""><title>修改资料</title></head><body>"
title2="<title>修改资料</title></head><body>"
End Select
		if len(users)<2 or len(users)>10 then errmsg=errmsg&""&we&"昵称字数不能小于2或大于10"&we0&"":flag=0
		if len(shen)<1 or len(shen)>4 then errmsg=errmsg&""&we&"省份字数不能小于1或大于4"&we0&"":flag=0
		if len(shii)<1 or len(shii)>4 then errmsg=errmsg&""&we&"城市字数不能小于1或大于4"&we0&"":flag=0
		if len(qq)<5 or len(qq)>20 then errmsg=errmsg&""&we&"Q Q号码格式错误"&we0&"":flag=0
		if len(mark)<5 then errmsg=errmsg&""&we&"签名字数不能小于5"&we0&"":flag=0
		if len(nian)=""  then errmsg=errmsg&""&we&"年龄不能为空"&we0&"":flag=0
		if mail=""  then errmsg=errmsg&""&we&"邮箱不能为空"&we0&"":flag=0
		if instr(mail,"@")=0  then errmsg=errmsg&""&we&"邮箱格式不正确"&we0&"":flag=0
	IF  flag<>"0" Then
		set rs=Server.CreateObject("Adodb.Recordset")
  		sql="select * FROM qingtian_user where ([mail]='"&mail&"' or [name]='"&users&"') and sid<>'"&qingtian.Formatsid(sid)&"'"
  		rs.open sql,conn,1,1
		if not (rs.bof and rs.eof)  then
		%>
			<%=title1%>
			<%if rs("name")=users then%>
			<%=we%>对不起,该用户昵称已被注册。<%=we0%>
			<%end if%>
			<%if rs("mail")=mail then%>
			<%=we%>对不起,该邮箱已注册过会员。<%=we0%>
			<%end if%>
			<%=sou%><a href="usermodify.asp?Action=add&amp;sid=<%=sidd%>">返回上级</a><%=we0%>
			<%=we%><a href="UserInfo.Asp?sid=<%=sidd%>">我的详细资料</a><%=we0%>

		<%
		else

	

			dim s1,s2


				set rs8=Server.CreateObject("Adodb.Recordset")
  				sql8="select * FROM qingtian_user where sid= '"&qingtian.Formatsid(sid)&"'"
  				rs8.open sql8,conn,1,3
                                if not (rs8.bof and rs8.eof) then
				rs8("name")=users
				rs8("diqu")=shen&","&shii
				rs8("mail")=mail
				rs8("nianlin")=nian
				rs8("qq")=qq
				rs8("mark")=mark
				rs8("xingbie")=sex
				rs8.update
                                else
                                qingtian.err("该会员不存在")
                                end if
				rs8.close
				set rs8=nothing
                                qingtian.addong("修改了基本资料")
       				%>
                                <%=title2%>
				<%=we%>资料修改成功!<br/>
				<a href="usermodify.asp?Action=add&amp;sid=<%=sidd%>">返回上级</a><%=we0%>
				<%=sou%><a href="UserInfo.Asp?sid=<%=sidd%>">我的详细资料</a><%=we0%>
				<%		


		end if
		rs.close
		set rs=nothing


	else
	%>
                <%=title1%>
		<%=errmsg%>
		<%=we%><a href="usermodify.asp?Action=add&amp;sid=<%=sidd%>">返回上级</a><%=we0%>
		<%=sou%><a href="UserInfo.Asp?sid=<%=sidd%>">我的详细资料</a><%=we0%>
<%	
end if
end sub
%>

